(function($){"use strict";UNCODE.animations=function(){function animate_css_grids_on_load(){$(".cssgrid-system").each(function(){var grid=$(this),sequential=grid.hasClass("cssgrid-animate-sequential")?!0:!1;UNCODE.animate_css_grids(grid,grid.find(".tmb-grid"),0,sequential,!1)})}var runWaypoints_TO,runWaypoints_carousel_TO,runWaypoints_delay=0,highlightComplexFunc=function($wrap,ev){var $lines=$(".heading-line-wrap",$wrap),not_animate=!1;$wrap.data("animate")===!0&&(not_animate=!0);var $rotatingTxt=$(".uncode-rotating-text-start",$wrap);if($rotatingTxt.length&&$rotatingTxt.attr("data-animated")!=="true")return;$lines.each(function(_key,_value){var $line=$(_value),$inners=$(".split-word-inner",$line),$highlights=$(".heading-text-highlight-inner",$line),highlitInnerFunc=function(ev){var delay=0;$highlights.each(function(h_key,high){var $highlight=$(high),$split=$highlight.closest(".split-word:not(.uncode-rotating-span)"),$nextSplit=$split.nextUntil(),$next=$(".heading-text-highlight-inner",$nextSplit),countCh=$split.text().length;$highlight.css({"-webkit-transition-duration":30*countCh+"ms","-moz-transition-duration":30*countCh+"ms","-o-transition-duration":30*countCh+"ms","transition-duration":30*countCh+"ms"}),delay+=30*countCh,$next.css({"-webkit-transition-delay":delay+"ms","-moz-transition-delay":delay+"ms","-o-transition-delay":delay+"ms","transition-delay":delay+"ms"})}),$highlights.removeAttr("data-animated"),_key+1===$lines.length&&$wrap.data("animate",!0)};$('.heading-text-highlight-inner[data-animated="yes"]',$line).length&&(not_animate?($highlights.each(function(h_key,high){var $highlight=$(high);$highlight.css({"-webkit-transition-duration":"0ms","-moz-transition-duration":"0ms","-o-transition-duration":"0ms","transition-duration":"0ms"})}),$highlights.removeAttr("data-animated")):typeof ev!="undefined"&&ev.type==="defer-highlights"?highlitInnerFunc():$inners.last().one("webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd",highlitInnerFunc))})};$.each($(".header-content-inner"),function(index,val){var element=$(val),transition="";element.hasClass("top-t-bottom")&&(transition="top-t-bottom"),element.hasClass("bottom-t-top")&&(transition="bottom-t-top"),element.hasClass("left-t-right")&&(transition="left-t-right"),element.hasClass("right-t-left")&&(transition="right-t-left"),element.hasClass("zoom-in")&&(transition="zoom-in"),element.hasClass("zoom-out")&&(transition="zoom-out"),element.hasClass("alpha-anim")&&(transition="alpha-anim"),element.hasClass("slight-anim")&&(transition="slight-anim");if(transition!=""){$(val).removeClass(transition);var container=element,containerDelay=container.attr("data-delay"),containerSpeed=container.attr("data-speed"),items=$(".header-title > *, .post-info",container);$.each(items,function(index,val){var element=$(val),delayAttr=containerDelay!=undefined?containerDelay:400;!element.hasClass("animate_when_almost_visible")&&!element.hasClass("translate_when_almost_visible")&&(delayAttr=Number(delayAttr)+400*index,containerSpeed!=undefined&&element.attr("data-speed",containerSpeed),element.addClass(transition+" animate_when_almost_visible").attr("data-delay",delayAttr))}),container.css("opacity",1)}});var delayAdd=0;window.waypoint_animation=function(ev){$.each($(".translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)").filter(function(){var $el=$(this);return $el.is("[data-delay-seq]")?$el.is("[data-delay]"):!0}),function(index,val){if($(val).hasClass("el-text-split")||($(val).closest(".unscroll-horizontal").length||$(val).closest(".index-scroll").length||$(val).closest(".tab-pane:not(.active)").length||$(val).closest(".panel:not(.active-group)").length||$(val).closest(".un-submenu").length||$(val).closest("#uncode-mobile-menu-block").length||$(val).closest(".has-unblock").length)&&!SiteParameters.is_frontend_editor)return!0;if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content"))return;var run=!0,$carousel=$(val).closest(".owl-carousel"),marquee=$(val).closest(".tmb-linear").length;$carousel.length&&(run=!1),$(val).closest(".megamenu-block-wrapper").length&&(run=!1),run&&new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(){var element=$(this.element),index=element.index(),delayAttr=element.attr("data-delay");delayAttr==undefined&&(delayAttr=0),requestTimeout(function(){element.addClass("start_animation")},delayAttr),UNCODE.isUnmodalOpen||this.destroy()},offset:UNCODE.isFullPage?"100%":"90%"})}),$.each($(".animate_inner_when_almost_visible"),function(index,val){if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content"))return;var run=!0,$carousel=$(val).closest(".owl-carousel");$carousel.length&&(run=!1),run&&new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(){var $element=$(this.element),$childs=$(".animate_when_parent_almost_visible",$element);$childs.each(function(key,el){var $child=$(el),delaySpeed=$child.attr("data-speed"),delayAttr=$child.attr("data-delay"),intervalAttr=$child.attr("data-interval");delayAttr==undefined&&(delayAttr=50*key),requestTimeout(function(){$child.addClass("start_animation"),$child.hasClass("anim-line-checker")&&$child.on("webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd",function(e){var $line=$child.closest(".heading-line-wrap")});var $wrapText=$child.closest(".animate_inner_when_almost_visible");highlightComplexFunc($wrapText,ev),$child.hasClass("anim-tot-checker")&&$child.on("webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd",function(e){$child.hasClass("anim-tot-checker")&&($wrapText.addClass("already-animated"),$element.trigger("already-animated"))})},delayAttr)}),$element.addClass("start_animation"),UNCODE.isUnmodalOpen||this.destroy()},offset:UNCODE.isFullPage?"100%":"90%"})})},window.waypoint_carousel_animation=function(ev){$.each($(".owl-carousel").find(".animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)"),function(index,val){if($(val).hasClass("el-text-split"))return!0;if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content"))return;var run=!0,$carousel=$(val).closest(".owl-carousel"),$first_item=$(val).closest('.owl-item[data-index="1"]'),$all_first=$('.owl-item[data-index="1"]',$carousel);(!$first_item.length||$first_item.attr("data-already-reached")==="true")&&$carousel.attr("data-front-edited")!=="true"&&(run=!1),run&&new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(){var element=$(this.element),index=element.index(),delayAttr=element.attr("data-delay");delayAttr==undefined&&(delayAttr=0),requestTimeout(function(){$first_item.length&&$first_item.attr("data-already-reached")!=="true"&&$all_first.attr("data-already-reached","true"),element.addClass("start_animation")},delayAttr),UNCODE.isUnmodalOpen||this.destroy()},offset:UNCODE.isFullPage?"100%":"90%"})}),$.each($(".owl-carousel").find(".animate_inner_when_almost_visible"),function(index,val){if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content"))return;var run=!0,$carousel=$(val).closest(".owl-carousel"),$first_item=$(val).closest('.owl-item[data-index="1"]'),$all_first=$('.owl-item[data-index="1"]',$carousel);(!$first_item.length||$first_item.attr("data-already-reached")==="true")&&$carousel.attr("data-front-edited")!=="true"&&(run=!1),run&&new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(){var $element=$(this.element),$childs=$(".animate_when_parent_almost_visible",$element);$childs.each(function(key,el){var $child=$(el),delaySpeed=$child.attr("data-speed"),delayAttr=$child.attr("data-delay"),intervalAttr=$child.attr("data-interval");delayAttr==undefined&&(delayAttr=50*key),requestTimeout(function(){$first_item.length&&$first_item.attr("data-already-reached")!=="true"&&$all_first.attr("data-already-reached","true"),$child.addClass("start_animation"),$child.hasClass("anim-line-checker")&&$child.on("webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd",function(e){var $line=$child.closest(".heading-line-wrap")});var $wrapText=$child.closest(".animate_inner_when_almost_visible");highlightComplexFunc($wrapText,ev),$child.hasClass("anim-tot-checker")&&$child.on("webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd",function(e){$child.hasClass("anim-tot-checker")&&$wrapText.addClass("already-animated")})},delayAttr)}),$element.addClass("start_animation"),UNCODE.isUnmodalOpen||this.destroy()},offset:UNCODE.isFullPage?"100%":"90%"})})};var runWaypoints=function(ev){typeof runWaypoints_TO!="undefined"&&runWaypoints_TO!==""&&(runWaypoints_delay=400),clearRequestTimeout(runWaypoints_TO),runWaypoints_TO=requestTimeout(function(){window.waypoint_animation(ev)},runWaypoints_delay),clearRequestTimeout(runWaypoints_carousel_TO),runWaypoints_carousel_TO=requestTimeout(function(){window.waypoint_carousel_animation(ev)},400)};runWaypoints(),animate_css_grids_on_load(),$(document.body).on("uncode_waypoints defer-highlights",function(ev){runWaypoints(ev)}),$("body").hasClass("compose-mode")&&typeof window.parent.vc!="undefined"&&(window.parent.vc.events.on("shortcodeView:updated",runWaypoints),window.parent.vc.events.on("shortcodeView:ready",runWaypoints))},UNCODE.animate_css_grids=function(container,elements,startIndex,sequential,filtering){var $allItems=elements.length-startIndex,showed=0,index=0,use_index=!1;filtering&&(sequential&&(use_index=!0),sequential=!1),$.each(elements,function(index,val){var $this=$(val),elInner=$("> .t-inside",val);if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content")||$(val).closest(".un-submenu").length||$(val).closest("uncode-mobile-menu-block").length)return;val[0]&&(val=val[0]),elInner.hasClass("animate_when_almost_visible")&&!elInner.hasClass("force-anim")&&new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(){var element=$("> .t-inside",this.element),parent=$(this.element),_index=use_index?index:0,delay=sequential?startIndex!==0?index-$allItems:index:_index,delayAttr=parseInt(element.attr("data-delay"));isNaN(delayAttr)&&(delayAttr=100);if(sequential||use_index)delay-=showed;var objTimeout=requestTimeout(function(){element.removeClass("zoom-reverse").addClass("start_animation"),showed=index},delay*delayAttr);parent.data("objTimeout",objTimeout),UNCODE.isUnmodalOpen||this.destroy()},offset:UNCODE.isFullPage?"100%":"90%"}),index++})}})(jQuery)